﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BoYuan.MvcCodeTemplates.FineUIMvc.Template
{
    public class AreaRegistrationTemplate : FineuiBase
    {
        public static string GetCode(TableModel tb)
        {
            string code = string.Format(@"
using System.Web.Mvc;

namespace {0}.Areas.{1}
{{
    public class {1}AreaRegistration : AreaRegistration 
    {{
        public override string AreaName {{ get {{ return ""{1}""; }} }}

        public override void RegisterArea(AreaRegistrationContext context) 
        {{
            context.MapRoute(
                ""{1}_default"",
                ""{1}/{{controller}}/{{action}}/{{id}}"",
                new {{ action = ""Index"", id = UrlParameter.Optional }}
            );
        }}
    }}
}}
"
              , tb.NamespaceStr            //0
              , tb.Namespace2Str           //1  
            );
            return code;
        }
    }
}
